import Vue from 'vue'
import Router from 'vue-router'
// 模板
import defaultLayout from '@/layout/default.vue'

Vue.use(Router)

export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            component: defaultLayout,
            children: [
                {
                    path: '',
                    component: () => import('@/views/home/Home.vue'),
                    name: 'home'
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('@/views/login/Login.vue')
        },
        // {
        //   path: '/about',
        //   name: 'about',
        //   // route level code-splitting
        //   // this generates a separate chunk (about.[hash].js) for this route
        //   // which is lazy-loaded when the route is visited.
        //   component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
        // },
        {
            path: '/about',
            component: defaultLayout,
            children: [
                {
                    path: '',
                    component: () => import('../views/about/About.vue'),
                    name: 'about'
                }
            ]
        }
    ]
})
